{% set pypi_name = 'yaql' %}
{% set upstream_version = upstream_version('1.1.3') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}
%global oldpython python
Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        YAQL - Yet Another Query Language
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
# for testing
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('ply') }}
BuildRequires:  {{ py3('python-dateutil') }}
BuildRequires:  {{ py3('python-subunit') }}
BuildRequires:  {{ py3('six') }}
BuildRequires:  {{ py3('testrepository') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
YAQL (Yet Another Query Language) is an embeddable and extensible query
language, that allows performing complex queries against arbitrary objects. It
has a vast and comprehensive standard library of frequently used querying
functions and can be extend even further with user-specified functions. YAQL is
written in python and is distributed via PyPI.

%package -n {{ py2name(py_versions='py3') }}
Summary:        YAQL - Yet Another Query Language
Requires:       {{ py3('Babel') }}
Requires:       {{ py3('ply') }}
Requires:       {{ py3('python-dateutil') }}
Requires:       {{ py3('six') }}
Conflicts:      %{oldpython}-yaql < %version-%release

%description -n {{ py2name(py_versions='py3') }}
YAQL (Yet Another Query Language) is an embeddable and extensible query
language, that allows performing complex queries against arbitrary objects. It
has a vast and comprehensive standard library of frequently used querying
functions and can be extend even further with user-specified functions. YAQL is
written in python and is distributed via PyPI.

This package contains the Python 3.x module.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

%check
PYTHON=python3 python3 setup.py testr

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%doc ChangeLog README.rst
%{_bindir}/yaql
%{python3_sitelib}/{{ pypi_name }}
%{python3_sitelib}/{{ pypi_name }}*.egg-info

%changelog
